package me.sdevil507.activemq.sync;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * 生产者Controller,用于测试多线程情况下,同步模式消息消费
 *
 * @author sdevil507
 */
@RestController
public class SyncProducerController {

    /**
     * 同步模式消息生产者
     */
    @Autowired
    private SyncProducer syncProducer;

    /**
     * 测试同步消息调用
     *
     * @param id 传递id
     */
    @GetMapping(value = "/test/{id}")
    public String test(@PathVariable("id") String id) {
        System.out.println(Thread.currentThread().getName());
        return syncProducer.sendSyncMessage(id);
    }
}
